MIDI codes
These constants can be used to match against status codes for MIDI messages,
accessed from fl_classes.FlMidiMsg.status
.
import midi
def OnMidiIn(msg: FlMidiMsg):
# Use a bitwise and to discard the channel number
if msg.status & 0xF0 == midi.MIDI_NOTEON:
print("event is a note on event")
MIDI_NOTEON
module-attribute
MIDI note-on
data1
is note numberdata2
is velocity (0
for note off)
MIDI_NOTEOFF
module-attribute
MIDI note-off
data1
is note numberdata2
is release value
MIDI_KEYAFTERTOUCH
module-attribute
MIDI key after-touch
data1
is note numberdata2
is after-touch value
MIDI_PROGRAMCHANGE
module-attribute
MIDI program change
data1
contains the program number (instrument) to select
MIDI_CHANAFTERTOUCH
module-attribute
MIDI channel after-touch
data1
is after-touch value
MIDI_PITCHBEND
module-attribute
MIDI_SYSTEMMESSAGE
module-attribute
MIDI system-exclusive (sysex) message.
Remaining data is included in the event.sysex
property.
MIDI_BEGINSYSEX
module-attribute
MIDI system-exclusive message start.
This should be the first byte of all sysex messages.
MIDI_ENDSYSEX
module-attribute
MIDI system-exclusive message end.
This should be the final byte of all sysex messages.
MIDI_MTCQUARTERFRAME
module-attribute
MIDI Time Code quarter-frame message.
data1
contains a time code value
MIDI_SYSTEMRESET
module-attribute
A system reset message. This is a single byte 0xFF
that instructs the
recipient to reset itself to the default state.